//
//  KSListViewDataSource.h
//  BasketBallLeagues
//
//  Created by kenshin on 4/25/17.
//  Copyright © 2017 kenshin. All rights reserved.
//

#import <Foundation/Foundation.h>

@protocol KSListViewDataSource <NSObject>

@required

- (void)startRequestCompletion:(void(^)(NSArray *dataItems, NSError *error))completion;

- (void)stopRequest;

/// Set request index, default 0.
- (void)setCurrentPage:(NSUInteger)currentPage;

@optional

/// whether or not to try to load more data, for example: if there is only one(or two,three... which did not fill the full screen) item, we will not need to load mored data
- (NSInteger)minItemCountOfTryToLoadMoreData;
/// Number of items once request, default 10.
- (NSUInteger)pageSize;

/// If you want to return total page items with merging current page data items by yourself in the implementation of startRequestCompletion: method, please return YES, default NO.
- (BOOL)isDataItemsMerged;

/// Save first page data to cache.
- (void)saveFirstPageDataToCache;

/// When you request the first page data, cache data will be loaded if network or server is not available.
- (NSArray *)firstPageDataCache;

@end
